Method: Efl::EcoreGetopt::REcoreGetopt#[]

Defined in:
lib/efl/ecore_getopt.rb

#[](k) ⇒ Object

[View source]

161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/efl/ecore_getopt.rb', line 161

def [] k
    ptype, ptr, sub_type = @values[k.to_s]
    return nil if ptype.nil?
    case ptype
    when:list
        require 'efl/eina_list'
        Efl::EinaList::REinaList.new(ptr.read_pointer).to_a sub_type
    when :choice
        p = ptr.read_pointer
        ( p==FFI::Pointer::NULL ? nil : p.read_string )
    when :string
        p = ptr.read_pointer
        (p==FFI::Pointer::NULL ? nil : p.read_string )
    when :pointer
        ptr.to_ptr
    else
        ptr.send 'read_'+ptype.to_s
    end
end